/*
 * @Description: 设置
 * @Author: iamsmiling
 * @Date: 2021-05-28 07:30:55
 * @LastEditTime: 2021-06-13 15:52:30
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/domain/local/list_tile_entity.dart';
import 'package:credit_business_circle/pages/mine/children/setting/setting_controller.dart';
import 'package:credit_business_circle/routes/app_routes.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class SettingPage extends GetView<SettingController> {
  const SettingPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("设置"),
        elevation: 1,
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            for (ListTileEntity item in controller.tiles)
              GestureDetector(
                behavior: HitTestBehavior.translucent,
                onTap: item.onTap,
                child: Container(
                  decoration: BoxDecoration(
                      border: Border(
                          bottom: BorderSide(
                              width: item == controller.tiles.last ? 0 : .5,
                              color: R.color.ffdddddd)),
                      color: R.color.ffffffff),
                  padding: EdgeInsets.symmetric(
                      vertical: R.dimen.dp18, horizontal: R.dimen.dp15),
                  child: Row(
                    children: [
                      Text(
                        item.label,
                        style: TextStyle(
                            fontSize: R.dimen.sp15, color: R.color.ff333333),
                      ),
                      Spacer(),
                      Text(
                        item.value,
                        style: TextStyle(
                            fontSize: R.dimen.sp15, color: R.color.ff111111),
                      ),
                      Container(
                          margin: EdgeInsets.only(left: R.dimen.dp10),
                          child: Image.asset(R.image.next))
                    ],
                  ),
                ),
              ),
            GestureDetector(
              onTap: () => Get.offAllNamed(AppRoutes.login),
              child: Container(
                alignment: Alignment.center,
                margin: EdgeInsets.only(top: R.dimen.dp13),
                width: R.dimen.width,
                color: R.color.ffffffff,
                padding: EdgeInsets.symmetric(vertical: R.dimen.dp18),
                child: Text(
                  "退出登录",
                  style: TextStyle(
                      fontSize: R.dimen.sp15, color: R.color.ff222222),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
